// @2023-12-09: 

#include "SchmidtCAM.h"

int main( int argc, char *argv[] ){

    uint32_t pin = 0;

    if( argc != 2 ){
        printf("> usage: %s pinning_time (unit ms)\n", argv[0]);
        return 0;
    }

/*    pin = atoi(argv[1]);*/

    pin = 600;

    int fd = open("/dev/mem", O_RDWR | O_SYNC);
    uint *ptr1 = mmap(NULL, 10, PROT_READ | PROT_WRITE, MAP_SHARED, fd, ADDR_GPIO_OUT);
    uint *gpio_reg      = ptr1;     // 0x41200000

    // socket_pinning( gpio_reg, pin );


    socket_pinning( gpio_reg, 1 );

    // sleep(2);
    uint32_t t_cnt = pin*1000;
    usleep(t_cnt);

    socket_pinning( gpio_reg, 0 );
    
    munmap(ptr1,10);
    close(fd);
}
